﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.YouTube;
using Google.GData.Extensions.MediaRss;
using Google.YouTube;
using System.Configuration;


namespace MVC3DEMO.Models.BS
{
    public class BS_FileStore
    {
        private SQLHeperDataContext sqlheper;
        public BS_FileStore()
        {
            sqlheper = new SQLHeperDataContext();
        }
        public List<FileStore> getListFile()
        {
            return (from c in sqlheper.FileStores select c).ToList();
        }
        public static YouTubeRequest GetRequest()
        {

            var request = HttpContext.Current.Session["YTRequest"] as YouTubeRequest;

            if (request == null)
            {

              
                var settings = new YouTubeRequestSettings("SampleWebApp", 
                                      ConfigurationManager.AppSettings["YouTubeAPIDeveloperKey"],
                                      ConfigurationManager.AppSettings["YouTubeUsername"],
                                      ConfigurationManager.AppSettings["YouTubePassword"]);

                request = new YouTubeRequest(settings);

                HttpContext.Current.Session["YTRequest"] = request;

            }

            return request;

        }
       
    }
}